<template>
    <view>
        <v-leaflet ref="bdleafletwx"></v-leaflet>
    </view>
</template>

<script>
    const plugin = requirePlugin('zhgeo-plugin')
    
    export default {
        data() {
            return {
                
            }
        },
        onLoad() {
            const container = this.$refs.bdleafletwx
            container.initLeafletMap(function(L) {
              wx.leaflet ??= {}
              wx.leaflet.L = L;
                require('../../static/lib/bdmap/tileLayer.baidu')
                var map = L.map(container, {
                    crs: L.CRS.Baidu,
                    minZoom: 3,
                    maxZoom: 18,
                    zoom: 18});
                L.tileLayer.baidu({ layer: 'vec' }).addTo(map),
                map.setView([31.300635, 120.632314]);

                // 添加marker
                let m = L.marker([31.300635, 120.632314], {
                    src: 'https://cdn.bootcdn.net/ajax/libs/leaflet/1.9.4/images/marker-icon-2x.png',
                    width: 32,
                    height: 32,
                    showInCenter: false,
                }).addTo(map);
                // 删除marer
                // map.removeLayer( m );
            });
        },
        methods: {
            
        }
    }
</script>

<style>

</style>
